﻿// *----------------------------------------------------------------
// Copyright (C) 2017 通通优品
// 版权所有。
// 
// 类名：ISqlGenerator.cs
// 功能描述：TongTongMall.Dapper
// 
// Create User：jym 2017/02/09
// 
// Edit User：UserName,EditTime
// Describe：Describe
// ----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using TongTongMall.Dapper.DapperExtensions.Mapper;
using TongTongMall.Dependecy;
using TongTongMall.Domain.PredicateForDapper;

namespace TongTongMall.Dapper.DapperExtensions.Sql
{
    public interface ISqlGenerator : ISingletonDependency
    {
        IDapperExtensionsConfiguration Configuration { get; }

        string Select<T>(IClassMapper classMap, IPredicate predicate, IList<ISort> sort, IDictionary<string, object> parameters, Expression<Func<T, object>> selector=null) where T : class, new();
        string SelectPaged<T>(IClassMapper classMap, IPredicate predicate, IList<ISort> sort, int page, int resultsPerPage, Expression<Func<T, object>> selector, IDictionary<string, object> parameters) where T : class, new();
        string SelectSet(IClassMapper classMap, IPredicate predicate, IList<ISort> sort, int firstResult, int maxResults, IDictionary<string, object> parameters);
        string Count(IClassMapper classMap, IPredicate predicate, IDictionary<string, object> parameters);

        string Insert(IClassMapper classMap);
        string Update(IClassMapper classMap, IPredicate predicate, IDictionary<string, object> parameters);

        string Update(object objModel, IClassMapper classMap, IPredicate predicate, IDictionary<string, object> parameters);

        string Delete(IClassMapper classMap, IPredicate predicate, IDictionary<string, object> parameters);

        string GetSequence(IClassMapper classMap);

        string IdentitySql(IClassMapper classMap);
        string GetTableName(IClassMapper map);
        string GetColumnName(IClassMapper map, IPropertyMap property, bool includeAlias);
        string GetColumnName(IClassMapper map, string propertyName, bool includeAlias);
        bool SupportsMultipleStatements();
    }
}
